<!DOCTYPE composition PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
  "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<ui:composition xmlns="http://www.w3.org/1999/xhtml"
                xmlns:s="http://jboss.com/products/seam/taglib"
                xmlns:ui="http://java.sun.com/jsf/facelets"
                xmlns:f="http://java.sun.com/jsf/core"
                xmlns:h="http://java.sun.com/jsf/html"
                xmlns:rich="http://richfaces.org/rich"
                template="/layout/template_box.xhtml"
                xmlns:a4j="http://richfaces.org/a4j">


  <ui:define name="head">
    <a4j:loadStyle src="/css/custom-theme/jquery-ui-1.8.2.custom.css"/>

  	<script type="text/javascript">
            function printObjectsSelected(output, sgcomponent){
                output.innerHTML=sgcomponent.getSelectedItems().pluck('state');
            }
      </script>

  </ui:define>

  <ui:define name="MenuInterno">
    <ui:include src="/layout/menu_declaracao.xhtml"/>
  </ui:define>


  <ui:define name="body">

    <h2 class="t_declaracao">Declarações</h2>

    <div id="tamanho_div">


      <h:form styleClass="form_confea" ajaxSubmit="true">
  
    	<fieldset>
			<h:messages globalOnly="true" styleClass="tool_alerta" />
	</fieldset>
   		
  
        <fieldset>
          <s:div rendered="#{listaDeclaracaos.size == 0}">
            <p class="tool_alerta"> Nenhuma Declaração cadastrada.</p>
          </s:div>

          <rich:dataTable value="#{listaDeclaracoes}" var="_declaracao" styleClass="grid_dados" cellpadding="0" cellspacing="0"
          border="0"  id="declaracaoLista" rows="#{declaracaoList.paginacao}"
          rowClasses="zebra,none"
          >
           
           
                      
            <rich:column >
              <f:facet name="header">Nome</f:facet>
              <h:outputText value="#{_declaracao.nome}"/>
            </rich:column>


            <rich:column style="width:15%">
              <f:facet name="header">Ações</f:facet>
                <span>
                    <s:link title="Editar Declaracao"                 
                    id="btnEditar" styleClass="editar2" view="/declaracoes/declaracao.xhtml" propagation="none">
	                   <f:param name="idDeclaracao" value="#{_declaracao.id}"/>
                    </s:link>

	   				<a4j:commandLink title="Gerar Relatório" styleClass="relatorio" id="showItem" ajaxSingle="true" immediate="true" action="#{declaracaoList.selecionar(_declaracao)}" oncomplete="Richfaces.showModalPanel('panel',{width:550, top:200});" limitToList="true" reRender="panel" />


		     	  <h:commandLink title="Excluir" id="btnExcluir" rendered="#{s:hasRole('Gestor')}" immediate="true"
	                 	 	action="#{declaracaoList.apagar}"
	                    	styleClass="excluir2" 
	                    	onclick="return confirm('Confirmar exclusão?')">
	                    </h:commandLink>
                    
					                    

   	  			
   	  			</span>
            </rich:column>

          </rich:dataTable>
          <rich:datascroller id="scrolInstituicao"
            for="declaracaoLista" maxPages="#{declaracaoList.paginacao}"
            align="center" renderIfSinglePage="false"  />
		
		
		  
		
			
        </fieldset>
      </h:form>
	<rich:modalPanel id="panel" width="550" autosized="true">
	        <f:facet name="header">
	            <h:panelGroup>
	                <h:outputText value="Gerar Declaração de #{declaracaoList.declaracao.nome} para o Aluno"></h:outputText>
	            </h:panelGroup>
	        </f:facet>
	        <f:facet name="controls">
	            <h:panelGroup>
	                <h:graphicImage value="/imagens/close.png" styleClass="hidelink" id="hidelink"/>
	                <rich:componentControl for="panel" attachTo="hidelink" operation="hide" event="onclick"/>
	            </h:panelGroup>
	        </f:facet>
	      
	         <div id="conteudo_pagina" >
       	<div id="tamanho_div" >
		   		<a4j:form id="formGeraDeclaracao" styleClass="form_confea">
					<a4j:outputPanel id="panelDeclaracaoForm" ajaxRendered="true">
					<s:validateAll>
					<fieldset>
	            <ol>
	           
	          			 <li>
								<fieldset>
									<legend>
										<h:outputText value="Dados da Declaração" />
									</legend>
								</fieldset>
							</li>
							
							<ui:include src="/componentes/estrutura_curso_select.xhtml"/>

	
	            </ol>
	            </fieldset>
	            <s:div id="divBotoes">
			        <h:commandLink styleClass="btn" valeu="Gerar" immediate="true" action="gerar">Gerar</h:commandLink>
		        </s:div>  
		        </s:validateAll>
					</a4j:outputPanel>
					</a4j:form>
					</div>
					</div>
					
	    </rich:modalPanel>
    </div>
  </ui:define>

</ui:composition>
